<?php
/*
 Flow Player Helper (free video player)
 Requed helpers HTML, Javascript
 */
Class FlowplayerHelper extends AppHelper {

	var $helpers = array('Html', 'Javascript');

	function loader($loadcss=false) {
		$out = $this -> Javascript -> link('flowplayer-3.2.6.min');
		if($loadcss = true)
			$out .= $this -> Html -> css('flowplayer');
		return $this -> output($out);

	}

	function player($file, $div, $autoplay=false, $width=400, $height=290) {

		if($autoplay = True) {$autoplay = "true";
		} else
			$autoplay = "false";
		$out = '
        <script>
    	window.onload = function() {  
         flashembed("' . $div . '",             
            {
                src:"flowplayer-3.2.7.swf",
                width: ' . $width . ', 
                height: ' . $height . '
            },
            
            {config: {   
                autoPlay:' . $autoplay . ',
                controlBarBackgroundColor:"0x2e8860",
                initialScale: "scale",
                videoFile: "flowplayer-700.flv"
            }} 
        );
    }
    </script>    
        ';
		return $this -> output($out);
	}
	
	function reproductor($file, $div, $autoplay=false, $width=400, $height=290) {
		if($autoplay = True) {$autoplay = "true";
		} else
			$autoplay = "false";
		$out = '
        <script>
    	window.onload = function() {  
         $f("example",             
            {
                src: "'. Router::url("/") . 'swf/flowplayer-3.2.7.swf",
                width: ' . $width . ', 
                height: ' . $height . '
            },
            
            {clip: {   
                autoPlay:' . $autoplay . ',
                controlBarBackgroundColor:"0x2e8860",
                initialScale: "scale",
                url: "'. Router::url("/") . 'videos/flowplayer-700.flv"
            }} 
        );
    }
    </script>    
        ';
		return $this -> output($out);
	}

}
?> 